% Remember to use the lgrind style

\Head{}
\File{./java/NodeItem.java}{2006}{4}{27}{19:09}{5567}
\L{\LB{\C{}/*}}
\L{\LB{_*_NodeItem.java}}
\L{\LB{_*}}
\L{\LB{_*_Created_on_October_29,_2005,_3:30_PM}}
\L{\LB{_*/\CE{}}}
\L{\LB{}}
\L{\LB{\K{package}_\V{project01};}}
\L{\LB{}}
\L{\LB{\K{import}_\V{javax}.\V{swing}.*;}}
\L{\LB{\K{import}_\V{javax}.\V{swing}.\V{event}.*;}}
\L{\LB{\K{import}_\V{java}.\V{awt}.*;}}
\L{\LB{\K{import}_\V{java}.\V{awt}.\V{event}.*;}}
\L{\LB{\K{import}_\V{java}.\V{util}.*;}}
\L{\LB{\K{import}_\V{java}.\V{io}.\V{Serializable};}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\C{}/**_}}
\L{\LB{_*_Describes_a_node_on_a_map.}}
\L{\LB{_*}}
\L{\LB{_*_\CE{}\V{author}_\V{Ian}_\V{Melnick}}}
\L{\LB{\C{}*/\CE{}}}
\L{\LB{\K{public}_\K{class}_\V{NodeItem}_\K{extends}_\V{MapItem}_\K{implements}_\V{Serializable}_\{}}
\L{\LB{}\Tab{4}{\C{}/**_Coordinates_that_this_NodeItem_is_located_at._*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\V{Point}_\V{location};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Whether_or_not_this_node_is_currently_selected_(i.e.,_by_the_user)._*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\K{boolean}_\V{selected};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Whether_or_not_this_node_is_visible_to_the_user_(invisible_if_corner).*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\K{boolean}_\V{visible};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Dijkstra_value:_this_node{'}s_distance_from_the_starting_point._*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\K{int}_\V{distanceToMe};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Dijkstra_value:_node_ID_of_node_directly_before_this_one_on_path._*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\K{int}_\V{sourceNode};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Holds_list_of_EdgeItems_this_node_is_connected_to._*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\V{Set}\<\V{EdgeItem}\>_\V{edges};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**}}
\L{\LB{}\Tab{5}{*_Dijkstra_value:_edge_that_provides_overall_shortest_route_that_this_is}}
\L{\LB{}\Tab{5}{*_connected_to.}}
\L{\LB{}\Tab{5}{*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\V{EdgeItem}_\V{sourceEdge};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**}}
\L{\LB{}\Tab{5}{*_Stores_nodes_that_this_node_is_connected_to_by_elevators/stairs.}}
\L{\LB{}\Tab{5}{*_String_map_name,_NodeItem_the_node._Zero_length_if_this_node_isn{'}t}}
\L{\LB{}\Tab{5}{*_a_floor_link.}}
\L{\LB{}\Tab{5}{*/\CE{}}}
\L{\LB{}\Tab{4}{\K{private}_\V{Map}\<\V{String},\V{NodeItem}\>_\V{floorLink};}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**}}
\L{\LB{}\Tab{5}{*_Create_a_new_NodeItem.}}
\L{\LB{}\Tab{5}{*/\CE{}}}
\index{NodeItem}\Proc{NodeItem}\L{\LB{}\Tab{4}{\K{public}_\V{NodeItem}(\V{String}_\V{map},_\V{Point}_\V{p},_\K{int}_\V{id})_\{}}
\L{\LB{}\Tab{8}{\K{this}.\V{map}_=_\V{map};}}
\L{\LB{}\Tab{8}{\K{this}.\V{location}_=_\V{p};}}
\L{\LB{}\Tab{8}{\K{this}.\V{visible}_=_\K{true};}}
\L{\LB{}\Tab{8}{\K{this}.\V{selected}_=_\K{false};}}
\L{\LB{}\Tab{8}{\K{this}.\V{id}_=_\V{id};}}
\L{\LB{}\Tab{8}{\K{this}.\V{description}_=_\S{}\3n\3\SE{}+\K{this}.\V{id}+\S{}\3_(\3\SE{}+\K{this}.\V{location}.\V{getX}()+\S{}\3,_\3\SE{}+\K{this}.\V{location}.\V{getY}()+\S{}\3)\3\SE{};}}
\L{\LB{}\Tab{8}{\K{this}.\V{edges}_=_\K{new}_\V{HashSet}\<\V{EdgeItem}\>();}}
\L{\LB{}\Tab{8}{\K{this}.\V{floorLink}_=_\K{new}_\V{HashMap}\<\V{String},\V{NodeItem}\>();}}
\L{\LB{}\Tab{8}{\K{this}.\V{resetDijkstraValues}();}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{8}{}}
\L{\LB{}\Tab{4}{\C{}/**_Get:_This_node{'}s_coordinates._*/\CE{}}}
\index{location}\Proc{location}\L{\LB{}\Tab{4}{\K{public}_\V{Point}_\V{location}()}\Tab{40}{\{_\K{return}_\K{this}.\V{location};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Set:_This_node{'}s_coordinates._*/\CE{}}}
\index{setLocation}\Proc{setLocation}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{setLocation}(\V{Point}_\V{p})}\Tab{40}{\{_\K{this}.\V{location}_=_\V{p};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Get:_Whether_or_not_this_node_is_selected_(i.e.,_by_user)._*/\CE{}}}
\index{selected}\Proc{selected}\L{\LB{}\Tab{4}{\K{public}_\K{boolean}_\V{selected}()}\Tab{40}{\{_\K{return}_\K{this}.\V{selected};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Set:_Toggle_whether_node_is_selected._*/\CE{}}}
\index{select}\Proc{select}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{select}()}\Tab{40}{\{_\K{this}.\V{selected}_=_!\K{this}.\V{selected};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Get:_Whether_or_not_this_node_is_visible_to_user._*/\CE{}}}
\index{visibility}\Proc{visibility}\L{\LB{}\Tab{4}{\K{public}_\K{boolean}_\V{visibility}()}\Tab{40}{\{_\K{return}_\K{this}.\V{visible};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Set:_Toggle_visibility._*/\CE{}}}
\index{visible}\Proc{visible}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{visible}()}\Tab{40}{\{_\K{this}.\V{visible}_=_!\K{this}.\V{visible};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Get:_List_of_EdgeItems_this_node_is_connected_to._*/\CE{}}}
\index{edges}\Proc{edges}\L{\LB{}\Tab{4}{\K{public}_\V{Set}\<\V{EdgeItem}\>_\V{edges}()}\Tab{40}{\{_\K{return}_\K{this}.\V{edges};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Get:_Dijkstra_value:_return_distance_from_start_node._*/\CE{}}}
\index{getDistToMe}\Proc{getDistToMe}\L{\LB{}\Tab{4}{\K{public}_\K{int}_\V{getDistToMe}()}\Tab{40}{\{_\K{return}_\K{this}.\V{distanceToMe};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Set:_Dijkstra_value:_set_distance_from_start_node_to_this._*/\CE{}}}
\index{setDistToMe}\Proc{setDistToMe}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{setDistToMe}(\K{int}_\V{dist})}\Tab{40}{\{_\K{this}.\V{distanceToMe}_=_\V{dist};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**}}
\L{\LB{}\Tab{5}{*_Set:_Dijkstra_value:_edge_that_we_follow_to_get_to_this_node_along}}
\L{\LB{}\Tab{5}{*_the_shortest_path.}}
\L{\LB{}\Tab{5}{*/\CE{}}}
\index{setSrcEdge}\Proc{setSrcEdge}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{setSrcEdge}(\V{EdgeItem}_\V{e})}\Tab{40}{\{_\K{this}.\V{sourceEdge}_=_\V{e};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**}}
\L{\LB{}\Tab{5}{*_Get:_Dijkstra_value:_edge_that_we_follow_to_get_to_this_node_along}}
\L{\LB{}\Tab{5}{*_the_shortest_path.}}
\L{\LB{}\Tab{5}{*/\CE{}}}
\index{getSrcEdge}\Proc{getSrcEdge}\L{\LB{}\Tab{4}{\K{public}_\V{EdgeItem}_\V{getSrcEdge}()}\Tab{40}{\{_\K{return}_\K{this}.\V{sourceEdge};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**}}
\L{\LB{}\Tab{5}{*_Set:_Dijkstra_value:_node_ID_that_is_right_before_us_along_the}}
\L{\LB{}\Tab{5}{*_shortest_path.}}
\L{\LB{}\Tab{5}{*/\CE{}}}
\index{setSrcNodeId}\Proc{setSrcNodeId}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{setSrcNodeId}(\K{int}_\V{id})}\Tab{40}{\{_\K{this}.\V{sourceNode}_=_\V{id};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**}}
\L{\LB{}\Tab{5}{*_Get:_Dijkstra_value:_node_ID_that_is_right_before_us_along_the}}
\L{\LB{}\Tab{5}{*_shortest_path.}}
\L{\LB{}\Tab{5}{*/\CE{}}}
\index{getSrcNodeId}\Proc{getSrcNodeId}\L{\LB{}\Tab{4}{\K{public}_\K{int}_\V{getSrcNodeId}()}\Tab{40}{\{_\K{return}_\K{this}.\V{sourceNode};}\Tab{76}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Resets_the_Dijkstra_values_to_ready_for_a_new_shortest-path_run._*/\CE{}}}
\index{resetDijkstraValues}\Proc{resetDijkstraValues}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{resetDijkstraValues}()_\{}}
\L{\LB{}\Tab{8}{\V{setDistToMe}(\-\N{1});}}
\L{\LB{}\Tab{8}{\V{setSrcNodeId}(\-\N{1});}}
\L{\LB{}\Tab{8}{\V{setSrcEdge}(\K{null});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Whether_or_not_this_node_is_connected_to_a_specific_EdgeItem._*/\CE{}}}
\index{hasEdge}\Proc{hasEdge}\L{\LB{}\Tab{4}{\K{public}_\K{boolean}_\V{hasEdge}(\V{EdgeItem}_\V{ei})_\{}}
\L{\LB{}\Tab{8}{\K{if}(\V{edges}.\V{contains}(\V{ei}))}\Tab{32}{\K{return}_\K{true};}}
\L{\LB{}\Tab{8}{\K{else}}\Tab{32}{\K{return}_\K{false};}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Connect_an_EdgeItem_to_this_node_if_node_doesn{'}t_already_have_it._*/\CE{}}}
\index{addEdge}\Proc{addEdge}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{addEdge}(\V{EdgeItem}_\V{ei})_\{}}
\L{\LB{}\Tab{8}{\V{edges}.\V{add}(\V{ei});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Disconnect_an_EdgeItem_from_this_node._*/\CE{}}}
\index{delEdge}\Proc{delEdge}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{delEdge}(\V{EdgeItem}_\V{ei})_\{}}
\L{\LB{}\Tab{8}{\V{edges}.\V{remove}(\V{ei});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Whether_or_not_this_node_links_to_other_floors_*/\CE{}}}
\index{isFloorLink}\Proc{isFloorLink}\L{\LB{}\Tab{4}{\K{public}_\K{boolean}_\V{isFloorLink}()_\{}}
\L{\LB{}\Tab{8}{\K{return}_!\V{floorLink}.\V{isEmpty}();}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Whether_or_not_this_node_has_a_link_to_specified_floor_*/\CE{}}}
\index{hasFloorLink}\Proc{hasFloorLink}\L{\LB{}\Tab{4}{\K{public}_\K{boolean}_\V{hasFloorLink}(\V{String}_\V{mapName})_\{}}
\L{\LB{}\Tab{8}{\K{return}_\V{floorLink}.\V{containsKey}(\V{mapName});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Add_a_floor/node_to_list_of_linked_floors_*/\CE{}}}
\index{addFloorLink}\Proc{addFloorLink}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{addFloorLink}(\V{String}_\V{mapName},_\V{NodeItem}_\V{linkedNode})_\{}}
\L{\LB{}\Tab{8}{\K{if}(!\V{floorLink}.\V{containsKey}(\V{mapName}))}}
\L{\LB{}\Tab{12}{\V{floorLink}.\V{put}(\V{mapName},_\V{linkedNode});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Remove_a_floor/node_from_list_of_linked_floors_*/\CE{}}}
\index{delFloorLink}\Proc{delFloorLink}\L{\LB{}\Tab{4}{\K{public}_\K{void}_\V{delFloorLink}(\V{String}_\V{mapName})_\{}}
\L{\LB{}\Tab{8}{\V{floorLink}.\V{remove}(\V{mapName});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Get_list_of_floors_this_node_connects_to_*/\CE{}}}
\index{connectedFloors}\Proc{connectedFloors}\L{\LB{}\Tab{4}{\K{public}_\V{Set}\<\V{String}\>_\V{connectedFloors}()_\{}}
\L{\LB{}\Tab{8}{\K{return}_\V{floorLink}.\V{keySet}();}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{}\Tab{4}{}}
\L{\LB{}\Tab{4}{\C{}/**_Based_on_a_floor,_return_the_connected_node_*/\CE{}}}
\index{floorLink}\Proc{floorLink}\L{\LB{}\Tab{4}{\K{public}_\V{NodeItem}_\V{floorLink}(\V{String}_\V{mapName})_\{}}
\L{\LB{}\Tab{8}{\K{return}_\V{floorLink}.\V{get}(\V{mapName});}}
\L{\LB{}\Tab{4}{\}}}
\L{\LB{\}}}
